const app = getApp(),url = app.globalData.url;
Page({
  data: {
    listArr:[
      // {
      //   id:1,name:'华为技术有限公司',address:'深圳市',num:56,
      //   img:'/img/21.png',
      //   info:{renshu:'1000',type:'民营',status:'互联网/软件'},
      // },
    ],
    where:{
      pageNum:0,
      pageSize:7,
      user_uid:''
    },
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },
  prisedetail(e){
    let pid = e.currentTarget.dataset.id
    let guid = e.currentTarget.dataset.guid
    wx.navigateTo({
      url: '/HomePage/prisedetail/prisedetail?id='+pid+'&guid='+guid,
    })
  },
  onShow: function () {
    var that = this
    var uid = wx.getStorageSync('user_massage')
    that.data.where.pageNum ++
    that.data.where.user_uid = uid.userUid
    let where = that.data.where
    console.log(where)
    wx.request({
      url:url+'interest/getInterestList',
      method: "GET",
      data:where,
      success:function(res){
        console.log("关注的企业",res);
        var ret = res.data
        if(ret.code == 200){
          if(ret.data.content != ''){
            var listArr=ret.data.content
            that.setData({listArr})
          }else{
            wx.showToast({
              title: '到底了~~',
              icon:'none'
            })
          }
        }else{
          wx.showToast({
            title: ret.msg,
            icon:'none'
          })
        }
      }
    })
  },
  all_list(){
    var that = this
    var listArr = that.data.listArr
    var uid = wx.getStorageSync('user_massage')
    that.data.where.pageNum ++
    that.data.where.user_uid = uid.userUid
    let where = that.data.where
    console.log(where)
    wx.request({
      url:url+'interest/getInterestList',
      method: "GET",
      data:where,
      success:function(res){
        console.log("关注的企业",res);
        var ret = res.data
        if(ret.code == 200){
          if(ret.data.content != ''){
            listArr=listArr.concat(ret.data.content)
            that.setData({listArr})
          }else{
            wx.showToast({
              title: '到底了~~',
              icon:'none'
            })
          }
        }else{
          wx.showToast({
            title: ret.msg,
            icon:'none'
          })
        }
      }
    })
  },
  onReachBottom: function () {
    var that = this
    that.all_list()
  },
  onHide: function () {
    var that = this
    that.data.where.pageNum = 0
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    var that = this
    that.data.where.pageNum = 0
  },
})